/**
 * 2016，thor.com，all rights reserved。
 * 
 * Project：		palmmall-core
 * Filename：	SMeterInputConverter.java
 * Created：		2016年8月30日
 * Creator：		wolv
 */
package com.thor.palmmall.rest.common;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.spi.common.SAttachment;

/**
 * @author wolv
 *
 */
public class AAttachmentConverter implements Converter<SAttachment, AAttachment> {

  public static AAttachmentConverter getInstance() {
    if (instance == null)
      instance = new AAttachmentConverter();
    return instance;
  }

  private static AAttachmentConverter instance;

  private AAttachmentConverter() {
  }

  @Override
  public AAttachment convert(SAttachment source) {
    if (source == null)
      return null;

    AAttachment target = new AAttachment();
    target.setId(source.getId());
    target.setName(source.getName());
    target.setSize(source.getSize());
    target.setFileType(source.getFileType());
    target.setCaption(source.getCaption());
    return target;
  }

}
